home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / daemons / timed / timed.h < prev   
Encoding:
C/C++ Source or Header  |  1989-03-14  |  2.6 KB  |  74 lines

  1. /*
  2.  * Copyright (c) 1983 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  *
  12.  *    @(#)timed.h    1.7 (Berkeley) 12/23/87
  13.  */
  14.  
  15. /*
  16.  * Time Synchronization Protocol
  17.  */
  18.  
  19. #define    TSPVERSION    1
  20. #define ANYADDR     NULL
  21.  
  22. struct tsp {
  23.     u_char    tsp_type;
  24.     u_char    tsp_vers;
  25.     u_short    tsp_seq;
  26.     union {
  27.         struct timeval tspu_time;
  28.         char tspu_hopcnt;
  29.     } tsp_u;
  30.     char tsp_name[MAXHOSTNAMELEN];
  31. };
  32.  
  33. #define    tsp_time    tsp_u.tspu_time
  34. #define    tsp_hopcnt    tsp_u.tspu_hopcnt
  35.  
  36. /*
  37.  * Command types.
  38.  */
  39. #define    TSP_ANY            0    /* match any types */
  40. #define    TSP_ADJTIME        1    /* send adjtime */
  41. #define    TSP_ACK            2    /* generic acknowledgement */
  42. #define    TSP_MASTERREQ        3    /* ask for master's name */ 
  43. #define    TSP_MASTERACK        4    /* acknowledge master request */
  44. #define    TSP_SETTIME        5    /* send network time */
  45. #define    TSP_MASTERUP        6    /* inform slaves that master is up */
  46. #define    TSP_SLAVEUP        7    /* slave is up but not polled */
  47. #define    TSP_ELECTION        8    /* advance candidature for master */
  48. #define    TSP_ACCEPT        9    /* support candidature of master */
  49. #define    TSP_REFUSE        10    /* reject candidature of master */
  50. #define    TSP_CONFLICT        11    /* two or more masters present */
  51. #define    TSP_RESOLVE        12    /* masters' conflict resolution */
  52. #define    TSP_QUIT        13    /* reject candidature if master is up */
  53. #define    TSP_DATE        14    /* reset the time (date command) */
  54. #define    TSP_DATEREQ        15    /* remote request to reset the time */
  55. #define    TSP_DATEACK        16    /* acknowledge time setting  */
  56. #define    TSP_TRACEON        17    /* turn tracing on */
  57. #define    TSP_TRACEOFF        18    /* turn tracing off */
  58. #define    TSP_MSITE        19    /* find out master's site */
  59. #define    TSP_MSITEREQ        20    /* remote master's site request */
  60. #define    TSP_TEST        21    /* for testing election algo */
  61. #define    TSP_SETDATE        22    /* New from date command */
  62. #define    TSP_SETDATEREQ        23    /* New remote for above */
  63. #define    TSP_LOOP        24    /* loop detection packet */
  64.  
  65. #define    TSPTYPENUMBER        25
  66.  
  67. #ifdef TSPTYPES
  68. char *tsptype[TSPTYPENUMBER] =
  69.   { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP", 
  70.   "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT", 
  71.   "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
  72.   "TEST", "SETDATE", "SETDATEREQ", "LOOP" };
  73. #endif
  74.